<template>
  <el-dialog :title="title" :visible.sync="dialogVisible" :width="newWidth" :before-close="handleClose"
    :close-on-click-modal='false' :append-to-body='true'>
    <slot name='content'></slot>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleClose" size="mini">取 消</el-button>
      <el-button type="primary" @click="submit" size="mini" v-if="isShowBtn" v-loading='ensureLoading'>确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    props: {
      dialogVisible: {
        type: Boolean,
        default () {
          return false
        }
      },
      title: {
        type: String,
        default () {
          return '提示'
        }
      },
      newWidth: {
        type: String,
        default () {
          return '30%'
        }
      },
      isShowBtn: {
        type: Boolean,
        default () {
          return true
        }
      },
      ensureLoading: {
        type: Boolean,
        default () {
          return false
        }
      }
    },
    methods: {
      handleClose() {
        this.$emit('closeDialog')
      },
      submit() {
        this.$emit('submitDialog')
      },
    }
  }
</script>

<style>

</style>
